(() => {
    let sites;
    sites = ["Google", "Runoob", "Taobao"];
    console.log(sites[0]);
    console.log(sites[1]);
    var arr_names = new Array(4);
    for (var i = 0; i < arr_names.length; i++) {
        arr_names[i] = i * 2;
        console.log(arr_names[i]);
    }
    // 数组结构
    let arr = [12, 13];
    var [x, y] = arr; // 将数组的两个元素赋值给变量 x 和 y
    console.log(x);
    console.log(y);
    // 数组迭代
    let j;
    var nums = [1001, 1002, 1003, 1004];
    for (j in nums) {
        console.log(nums[j]);
    }
    // forEach
    nums.forEach(value => {
        console.log(value);
    });
    let num = [7, 8, 9];
    num.forEach(function (value) {
        console.log(value);
    });
    num = num.map(Math.sqrt);
    num.forEach(v => {
        console.log(v);
    });
    // push pop
    var numbers = new Array(1, 4, 9);
    var length = numbers.push(10);
    console.log("new numbers is : " + numbers); // 1,4,9,10 
    length = numbers.push(20);
    console.log("new numbers is : " + numbers); // 1,4,9,10,20
    numbers.pop();
    console.log("new numbers is : " + numbers); // 1,4,9,10
    numbers.pop();
    console.log("new numbers is : " + numbers); // 1,4,9
})();
